package com.llm.travel_agent_assistant.controller;

import com.llm.travel_agent_assistant.dto.BudgetAnalyzeDTO;
import com.llm.travel_agent_assistant.dto.GeneratePlanDTO;
import com.llm.travel_agent_assistant.dto.QuestionDTO;
import com.llm.travel_agent_assistant.dto.Result;
import com.llm.travel_agent_assistant.service.OpenAiService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/api/v1")
public class OpenAiController {

    private final OpenAiService openAiService;

    @Resource
    private HttpServletRequest request;

    public OpenAiController(OpenAiService openAiService) {
        this.openAiService = openAiService;
    }

    @PostMapping("/generate_travel_plan")
    public Result generateTravelPlan(@RequestBody GeneratePlanDTO generatePlanDTO) {
        return openAiService.generateTravelPlan(generatePlanDTO);
    }

    @PostMapping("/budget_analyze")
    public Result budgetAnalyze(@RequestBody BudgetAnalyzeDTO budgetAnalyzeDTO) {
        return openAiService.budgetAnalyze(budgetAnalyzeDTO);
    }

    @PostMapping("/any_question")
    public Result resolveAnyQuestion(@RequestBody QuestionDTO questionDTO) {
        return openAiService.solveAnyQuestion(questionDTO);
    }
}
